package com.iotteam.androidbase.moudules.sensor_add.presenter;

import com.iotteam.androidbase.R;
import com.iotteam.androidbase.commen.network.Api;
import com.iotteam.androidbase.commen.network.core.HttpListener;
import com.iotteam.androidbase.commen.network.core.HttpManager;
import com.iotteam.androidbase.commen.utils.PLog;
import com.iotteam.androidbase.commen.utils.ToastUtil;
import com.iotteam.androidbase.moudules.sensor_add.view.IAddSensorView;

import java.util.HashMap;
import java.util.Map;

import static android.content.ContentValues.TAG;

/**
 * Created by lidechen on 5/5/17.
 */

public class AddSensorPresenterCompl implements IAddSensorPresenter {

    private IAddSensorView mView;

    private Map<String, String> mBindingParam;

    public AddSensorPresenterCompl(IAddSensorView view){
        mView = view;
    }

    @Override
    public void binding() {
        String terminalid = mView.getSensorID();
        String password = mView.getCheckword();

        mBindingParam = new HashMap<>();
        mBindingParam.put("terminalid", "865067020720534");
        mBindingParam.put("password", "d326f5");
        mBindingParam.put("moblie", "15910992968");

        HttpManager.getInstance().postString(Api.binding, mBindingParam, new HttpListener<String>() {
            @Override
            public void onSucceed(int what, String bean) {
                PLog.i(TAG, "onSucceed "+bean);
                ToastUtil.showLong(R.string.dialog_login_success);
            }

            @Override
            public void onFailed(int what, Exception e) {

            }

            @Override
            public void onStart(int what) {

            }

            @Override
            public void onFinish(int what) {

            }
        });
    }
}
